
package org.example.utils;

import lombok.Data;

/**
<<<<<<< HEAD
 * @Description: 核验的控制层
 * @Author:曹震
 * @Date: 2024/11/24 14:42
=======
 * ClassName: R
 * Description:
 *
 * @Author Kotaro
 * @Create 2024/11/23 10:25
 * @Version 1.0
>>>>>>> Kotaro/elderly_care_work/master
 */
@Data
public class R<T> {
    private Integer code;
    private String message;
    private T data;
    public R(){}
    public R(Integer code , String message, T data){
        this.code=code;
        this.message=message;
        this.data=data;
    }
    // 成功响应的静态方法
    public static <T> R<T> successful(String message, T data) {
        return new R<>(200, message, data);
    }

    // 空数据响应的静态方法
    public static <T> R<T> empty(String message, T data) {
        return new R<>(204, message, data);
    }
    public static <T> R<T> error(String message, T data){
        return new R<>(500,message,data);
    }

}


